//
//  Person.m
//  复习2
//
//  Created by Justsoso on 16/3/12.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "Person.h"

#import "Dog.h"

@implementation Person
- (instancetype)init
{
    self = [super init];
    if (self) {
        // 2.1
//        [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(feed:) userInfo:nil repeats:YES];
        // 2.3
        [[NSNotificationCenter defaultCenter]  addObserver:self
                                                  selector:@selector(feed:)
                                                      name:@"hungry"
                                                    object:nil];
    }
    return self;
}


- (void)feed:(Dog *)d
{
    NSLog(@"喂下%@狗粮",self.myDog.firstName);
    self.myDog.hungry += 50;
}
@end
